package com.xuexiang.xuidemo.app.activity;

import android.os.Bundle;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.xuexiang.xui.utils.WidgetUtils;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.app.DataProvider;
import com.xuexiang.xuidemo.app.adapter.WordListAdapter;
import com.xuexiang.xuidemo.app.adapter.WordListItem;
import com.xuexiang.xuidemo.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class TestStartPage extends BaseActivity {

    @BindView(R.id.wordListView)
    RecyclerView recyclerView;

    private WordListAdapter mAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.app_test_start_page;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }

    private void initView() {
        WidgetUtils.initRecyclerView(recyclerView);
        recyclerView.setAdapter(mAdapter = new WordListAdapter(this));
        GridLayoutManager layoutManage = new GridLayoutManager(this, 3);
        recyclerView.setLayoutManager(layoutManage);
        mAdapter.refresh(getSelectionItems());
    }

    private List<WordListItem> getSelectionItems() {
        return DataProvider.getWordItems();
    }


}